<?php

use Phalcon\Mvc\Model;
class ModelBase extends Model
{
    protected $prefix;
    public function initialize() {
        $this->prefix=$this->getDI()->get('config')->database['prefix'];
    
    }
    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        $tables=  explode('\\', get_class($this));
        $table=  array_pop($tables);
        return $this->prefix . strtolower(preg_replace('/(?<=[a-z])(?=[A-Z])/', '_',$table ));
    }
}

?>